package com.yuan.java.commonIO;

import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
import org.apache.commons.io.monitor.FileAlterationObserver;

import java.io.File;

public class FileListenerAdaptor extends FileAlterationListenerAdaptor {

    @Override
    public void onStart(FileAlterationObserver arg0) {
        super.onStart(arg0);
    }

    @Override
    public void onStop(FileAlterationObserver arg0) {
        super.onStop(arg0);
    }

    @Override
    public void onDirectoryCreate(File fold) {
        System.out.println("fold: " + fold.getAbsolutePath() + " is created.");
        super.onDirectoryCreate(fold);
    }

    @Override
    public void onDirectoryChange(File fold) {
        System.out.println("fold: " + fold.getAbsolutePath() + " is changed.");
        super.onDirectoryChange(fold);
    }

    @Override
    public void onDirectoryDelete(File fold) {
        System.out.println("fold: " + fold.getAbsolutePath() + " is deleted.");
        super.onDirectoryDelete(fold);
    }

    @Override
    public void onFileCreate(File file) {
        System.out.println("file: " + file.getAbsolutePath() + " is created.");
        super.onFileCreate(file);
    }

    @Override
    public void onFileChange(File file) {
        System.out.println("file: " + file.getAbsolutePath() + " is changed.");
        super.onFileChange(file);
    }

    @Override
    public void onFileDelete(File file) {
        System.out.println("file: " + file.getAbsolutePath() + " is deleted");
        super.onFileDelete(file);
    }

}  